﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace Data.Core.Specifications
{
    /// <summary>
    /// The <see cref="IOrderBySpecification{TEntity}"/> interface defines a basic contract to express specifications declaratively.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IOrderBySpecification<T>
    {
        OrderDirection Direction { get; }
	    OrderDirection ThenByDirection { get; }

        /// <summary>
        /// Gets the expression compiled that encapsulates the criteria of the specification.
        /// </summary>
        Expression<Func<T, object>> OrderByPredicate { get; }

        /// <summary>
        /// Gets the expression compiled that encapsulates the criteria of the specification.
        /// </summary>
        Expression<Func<T, object>> OrderThanByPredicate { get; }

        IOrderedQueryable<T> ApplyOrderBy(IQueryable<T> query);
    }
}
